package com.nimt.hqgl_idea.param;

/**
 * 封装一个分页类
 */
public class PageParam {
    /* 当前页码,从请求报文中获取 */
    private Integer currentPage;
    /* 页面容量, 从请求报文中获取*/
    private Integer pageSize;
    /* 数据总行数,调用dao的方法查询出来的 */
    private Integer totalCount;
    /* 总页数, 当设置了数据总行数, 自动算出总页数 */
    private Integer totalPage;
    private String keywords;

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
        this.totalPage = (int)Math.ceil(totalCount*1.0/pageSize);
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        if ("".equals(keywords)) keywords = null;
        this.keywords = keywords;
    }

}

